<template>
  <div class="sign box clmcenter">
    <p>{{ userStore.userInfo.name }}</p>
    <van-button type="success" @click="changeName">修改名字</van-button>
    <van-button type="danger" @click="getData">获取数据</van-button>
    <p>当前展厅：{{ room }}</p>
  </div>
</template>

<script setup lang="ts">
import { useUserStore } from '@/stores/user'
import { getDateApi } from '@/apis/user'
import { ref } from 'vue'

const userStore = useUserStore()

// 修改名字
const changeName = () => {
  userStore.updateUserInfo('Jack')
}

const room = ref('')

// 获取数据
const getData = async () => {
  const res = await getDateApi({ e: '5', d: '7', token: '97233153ff', date: '2023-11-28' })
  room.value = res.data.data.showroom
  // console.log(res)
}
</script>

<style lang="scss" scoped>
.sign {
  font-size: 30px;
  button {
    margin-top: 1rem;
  }
}
</style>
